<!doctype html>
<!-- Created with GFM2HTML: https://github.com/rvagg/gfm2html -->
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="created-with" content="https://github.com/rvagg/gfm2html">

    <style type="text/css">
/* most of normalize.css */
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block;}[hidden],template{display:none;}html{font-family:sans-serif;/*1*/-ms-text-size-adjust:100%;/*2*/-webkit-text-size-adjust:100%;/*2*/}body{margin:0;}a{background:transparent;}a:focus{outline:thindotted;}a:active,a:hover{outline:0;}h1{font-size:2em;margin:0.67em0;}abbr[title]{border-bottom:1pxdotted;}b,strong{font-weight:bold;}dfn{font-style:italic;}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;}mark{background:#ff0;color:#000;}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em;}pre{white-space:pre-wrap;}q{quotes:"\201C""\201D""\2018""\2019";}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup{top:-0.5em;}sub{bottom:-0.25em;}img{border:0;}svg:not(:root){overflow:hidden;}table{border-collapse:collapse;border-spacing:0;}

html {
  font: 14px 'Helvetica Neue', Helvetica, arial, freesans, clean, sans-serif;
}

.container {
  line-height: 1.6;
  color: #333;
  background: #eee;
  border-radius: 3px;
  padding: 3px;
  width: 790px;
  margin: 10px auto;
}

.body-content {
  background-color: #fff;
  border: 1px solid #CACACA;
  padding: 30px;
}

.body-content > *:first-child {
  margin-top: 0 !important;
}

a, a:visited {
  color: #4183c4;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

p, blockquote, ul, ol, dl, table, pre {
  margin: 15px 0;
}

  .markdown-body h1
, .markdown-body h2
, .markdown-body h3
, .markdown-body h4
, .markdown-body h5
, .markdown-body h6 {
  margin: 20px 0 10px;
  padding: 0;
  font-weight: bold;
}

h1 {
  font-size: 2.5em;
  color: #000;
  border-bottom: 1px solid #ddd;
}

h2 {
  font-size: 2em;
  border-bottom: 1px solid #eee;
  color: #000;
}

img {
  max-width: 100%;
}

hr {
  background: transparent url("/img/hr.png") repeat-x 0 0;
  border: 0 none;
  color: #ccc;
  height: 4px;
  padding: 0;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

tr:nth-child(2n) {
  background-color: #f8f8f8;
}

.markdown-body tr {
  border-top: 1px solid #ccc;
  background-color: #fff;
}

td, th {
  border: 1px solid #ccc;
  padding: 6px 13px;
}

th {
  font-weight: bold;
}

blockquote {
  border-left: 4px solid #ddd;
  padding: 0 15px;
  color: #777;
}

blockquote > :last-child, blockquote > :first-child {
  margin-bottom: 0px;
}

pre, code {
  font-size: 13px;
  font-family: 'UbuntuMono', monospace;
  white-space: nowrap;
  margin: 0 2px;
  padding: 0px 5px;
  border: 1px solid #eaeaea;
  background-color: #f8f8f8;
  border-radius: 3px;
}

pre > code {
  white-space: pre;
}

pre {
  overflow-x: auto;
  white-space: pre;
  padding: 10px;
  line-height: 150%;
  background-color: #f8f8f8;
  border-color: #ccc;
}

pre code, pre tt {
  margin: 0;
  padding: 0;
  border: 0;
  background-color: transparent;
  border: none;
}

  .highlight .c
, .highlight .cm
, .highlight .cp
, .highlight .c1 {
    color:#999988;
    font-style:italic;
}

.highlight .err {
  color:#a61717;
  background-color:#e3d2d2
}

  .highlight .o
, .highlight .gs
, .highlight .kc
, .highlight .kd
, .highlight .kn
, .highlight .kp
, .highlight .kr {
    font-weight:bold
}

.highlight .cs {
  color:#999999;
  font-weight:bold;
  font-style:italic
}

.highlight .gd {
  color:#000000;
  background-color:#ffdddd
}

.highlight .gd .x {
  color:#000000;
  background-color:#ffaaaa
}

.highlight .ge {
  font-style:italic
}

  .highlight .gr
, .highlight .gt {
    color:#aa0000
}

  .highlight .gh
, .highlight .bp {
    color:#999999
}

.highlight .gi {
  color:#000000;
  background-color:#ddffdd
}

.highlight .gi .x {
  color:#000000;
  background-color:#aaffaa
}

.highlight .go {
  color:#888888
}

  .highlight .gp
, .highlight .nn {
    color:#555555
}


.highlight .gu {
  color:#800080;
  font-weight:bold
}


.highlight .kt {
  color:#445588;
  font-weight:bold
}

  .highlight .m
, .highlight .mf
, .highlight .mh
, .highlight .mi
, .highlight .mo
, .highlight .il {
    color:#009999
}

  .highlight .s
, .highlight .sb
, .highlight .sc
, .highlight .sd
, .highlight .s2
, .highlight .se
, .highlight .sh
, .highlight .si
, .highlight .sx
, .highlight .s1 {
    color:#d14
}

.highlight .n {
  color:#333333
}

  .highlight .na
, .highlight .no
, .highlight .nv
, .highlight .vc
, .highlight .vg
, .highlight .vi
, .highlight .nb {
    color:#0086B3
}

.highlight .nc {
  color:#445588;
  font-weight:bold
}

.highlight .ni {
  color:#800080
}

  .highlight .ne
, .highlight .nf {
    color:#990000;
    font-weight:bold
}

.highlight .nt {
  color:#000080
}

.highlight .ow {
  font-weight:bold
}

.highlight .w {
  color:#bbbbbb
}

.highlight .sr {
  color:#009926
}

.highlight .ss {
  color:#990073
}

.highlight .gc {
  color:#999;
  background-color:#EAF2F5
}</style>
  </head>
  <body>
    <div class="container">
      <div class="body-content"><h1 id="concat-stream">concat-stream</h1>
<div class="highlight"><pre><span class="nv">$ </span>npm install concat-stream
</pre></div>

<p>then</p>
<div class="highlight"><pre><span class="kd">var</span> <span class="nx">concat</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;concat-stream&#39;</span><span class="p">)</span>
<span class="kd">var</span> <span class="nx">fs</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;fs&#39;</span><span class="p">)</span>

<span class="kd">var</span> <span class="nx">read</span> <span class="o">=</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">createReadStream</span><span class="p">(</span><span class="s1">&#39;readme.md&#39;</span><span class="p">)</span>
<span class="kd">var</span> <span class="nx">write</span> <span class="o">=</span> <span class="nx">concat</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">data</span><span class="p">)</span> <span class="p">{})</span>

<span class="nx">read</span><span class="p">.</span><span class="nx">pipe</span><span class="p">(</span><span class="nx">write</span><span class="p">)</span>
</pre></div>

<p>works with arrays too!</p>
<div class="highlight"><pre><span class="kd">var</span> <span class="nx">write</span> <span class="o">=</span> <span class="nx">concat</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">data</span><span class="p">)</span> <span class="p">{})</span>
<span class="nx">write</span><span class="p">.</span><span class="nx">write</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">])</span>
<span class="nx">write</span><span class="p">.</span><span class="nx">write</span><span class="p">([</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">])</span>
<span class="nx">write</span><span class="p">.</span><span class="nx">end</span><span class="p">()</span>
<span class="c1">// data will be [1,2,3,4,5,6] in the above callback</span>
</pre></div>

<p>works with buffers too! can&#39;t believe the deals!</p>
<div class="highlight"><pre><span class="kd">var</span> <span class="nx">write</span> <span class="o">=</span> <span class="nx">concat</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">data</span><span class="p">)</span> <span class="p">{})</span>
<span class="nx">write</span><span class="p">.</span><span class="nx">write</span><span class="p">(</span><span class="k">new</span> <span class="nx">Buffer</span><span class="p">(</span><span class="s1">&#39;hello &#39;</span><span class="p">))</span>
<span class="nx">write</span><span class="p">.</span><span class="nx">write</span><span class="p">(</span><span class="k">new</span> <span class="nx">Buffer</span><span class="p">(</span><span class="s1">&#39;world&#39;</span><span class="p">))</span>
<span class="nx">write</span><span class="p">.</span><span class="nx">end</span><span class="p">()</span>
<span class="c1">// data will be a buffer that toString()s to &#39;hello world&#39; in the above callback</span>
</pre></div>

<p>MIT LICENSE</p>
</div>
    </div>
  </body>
</html>